<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ page import="com.zhufei.entity.Sponsor" %>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
	<head>
		<base href="<%=basePath%>">

		<title>添加新闻</title>

		<meta http-equiv="pragma" content="no-cache">
		<meta http-equiv="cache-control" content="no-cache">
		<meta http-equiv="expires" content="0">
		<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
		<meta http-equiv="description" content="This is my page">
		<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->

		<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
		<style type="text/css">
<!--
body,td,th {
	font-size: 13px;
}
-->
</style>
	</head>

	<body>
		<table width="99%" border="5" align="center" cellpadding="5"
			cellspacing="5" bordercolor="#CCCCCC" bgcolor="#FFFFFF">
			<tr>
				<td height="16" background="admin/images/topbg.gif"
					bgcolor="#F7F7F7">
					<span class="STYLE1"> <img src="admin/images/pic5.gif"
							width="28" height="22" />您现在所在的位置是： <a
						href="admin/adminIndex.jsp">管理首页</a> -&gt;<strong><font color="red">编辑捐赠信息</font></strong></span>
				</td>
			</tr>
			<tr>
				<td colspan="2" bgcolor="#FFFFFF">
				
				
<script language="javascript">

function check()
{ 
	str = form1.time.value; 
    strFirm = form1.donator.value;
	strHandicapped = form1.handicapped.value;
	str = str.match(/^(\d{2,4})(-|\/)(\d{1,2})\2(\d{1,2})$/); 
	if (str == null)
	{ 
		alert('你输入的日期格式无效'); 
		return false; 
	}
	else if (strFirm=="")
	{ 
		alert('捐赠企业名称不能为空');
		return false;
	} 
	else if(strHandicapped=="")
	{
		alert('残疾人姓名不能为空');
		return false;
	}
	else 
   		 return true;
} 
</script>

			    <form action="sponsorServlet?action=edit" method="post"
						 name="form1" onSubmit="return check()">
						<br>

					<table width="62%" height="211" border="2" align="center" cellpadding="1"
							cellspacing="1" bordercolor="#FFFFFF" bgcolor="#CCCCCC">
					<%
							int index = Integer.parseInt(request.getParameter("index"));
							ArrayList<Sponsor> sponsorList = (ArrayList<Sponsor>)session.getAttribute("donatorList");
							Sponsor spon = sponsorList.get(index);
					%>
						<tr align="center" bgcolor="#F7F7F7" height="20">
							<td width="30%" height="25" align="right" background="images/topbg.gif">捐赠企业或个人名称    ：</td>
							<td width="50%" colspan="2" background="images/topbg.gif">
							<input name="donator" type="text" id="handicapped" size="30%" maxlength="30" value="<%=spon.getName() %>"></td>
						</tr>
						<tr align="center" bgcolor="#F7F7F7" height="20">
						  <td height="25" align="right" background="images/topbg.gif">残疾人姓名      ：</td>
						  <td colspan="2" background="images/topbg.gif">
						 <input name="handicapped" type="text" id="donator" size=30% maxlength="30" value="<%=spon.getHandicapped() %>">
						  </td>
					  </tr>
					  <tr align="center" bgcolor="#F7F7F7" height="20">
						  <td height="25" align="right" background="images/topbg.gif">捐助时间      ：</td>
						  <td colspan="2" background="images/topbg.gif">
						  <%
						  String timeStr= spon.getDatetime();
						  int Endindex = timeStr.indexOf(" ");
						  timeStr = timeStr.substring(0,Endindex);
						   %>
						 <input name="time" type="text" id="time" size=30% maxlength="30" value="<%=timeStr %>">
						  </td>
					  </tr>
					  <tr align="center" bgcolor="#F7F7F7" height="20">
						  <td height="25" align="right" background="images/topbg.gif">捐赠者类型;</td>
						  <td colspan="2" background="images/topbg.gif"><input name="sponsor" type="radio" value = "qiye" checked>企业
                                        <input type="radio" name="sponsor" value = "geren">个人</td>
				      </tr>
						<tr align="center" bgcolor="#F7F7F7" height="20">
						  <td height="25" align="right" background="images/topbg.gif">&nbsp;</td>
						  <td colspan="2" background="images/topbg.gif"><input type="submit" name="submit" id="submit" value="提交">
						  <input type="reset" name="reset" id="reset" value="重置"></td>
				      </tr>
				      <input name="id" type="hidden" value="<%=spon.getID() %>">
				    </table>
				  </form>
					<br>
				</td>
			</tr>
		</table>
		<br>
		<br>
	</body>
</html>
